<?php
namespace app\common\middleware;

use app\admin\middleware\PhoneExistCheck as AdminPhoneExistCheck;
use app\user\middleware\PhoneExistCheck as DefaultPhoneExistCheck;

/**
 * 检查用户是否有手机号
 */
class PhoneExistCheck
{
    public function handle($request, \Closure $next)
    {
        if ($request->isAdminRoute) {
            $check = new AdminPhoneExistCheck();
        } else {
            $check = new DefaultPhoneExistCheck();
        }

        return $check->handle($request, $next);

    }
}
